//自定义插件

import { useIntersectionObserver } from '@vueuse/core'



export const LazyImgPlugin = {
install (app) {

//懒加载图片指令
app.directive('img-lazy',(el,binding)=>{
  const { stop } = useIntersectionObserver(
    el,
    ([entry]) => {
      if (entry.isIntersecting) {
        el.src = binding.value
        stop()
      }
    }
  )

})
}
}